package game;

public class Brewery extends Ownable{
	
	//
	// Variables
	//
	///////////////////////////////////////////////////////////////////////////
	private int breweryOwned;
	
	//
	// Constructor
	// 
	///////////////////////////////////////////////////////////////////////////
	public Brewery(String name){
		this.name = name;
		setPrice(3000);
	}
	
	//
	// Methods
	//
	///////////////////////////////////////////////////////////////////////////
	
	// Returnerer rent
	public int getRent(Player player){
		return 100 * DiceCup.getSum() * breweryOwned;
	}
	
	// tilføjer en landOnField-metode til Brewery for at holde styr, hvor mange der er ejet
	public void landOnField(Player player) {
		super.landOnField(player);
		Brewery[] brewery = new Brewery[2]; 
		brewery[0] = (Brewery)Board.fields[12];
		brewery[1] = (Brewery)Board.fields[28];
	
		breweryOwned = 0;
		
		for(int i=0 ; i < brewery.length ; i++){
			
				if(player == brewery[i].getOwner()){
					breweryOwned++;
				}	
		}
		
	}
}
